
<template>
  <section class="testDriver">
    <el-dialog
      v-dialogDrag
      :close-on-click-modal="true"
      :title="textMap[popupsState]"
      :append-to-body="true"
      :visible.sync="curPopupsVisible"
      width="900px"
      @close="closePopups"
    >
      <dialogHeader
        slot="title"
        :title="textMap[popupsState]"
        :style-type="$store.state.app.dialogType"
      />
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents.filter(o => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire+ comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :code="formField[comp.codeField]"
            :disabled="true"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button
          v-for="comp in tableButtons"
          :key="comp.compKey"
          :type="comp.type"
          @click="comp.clickEvent"
        >{{ comp.text }}</el-button>
      </div>
    </el-dialog>
  </section>
</template>
<script>
import { formMixins } from '@/components/mixins/formMixins'
export default {
  name: 'TDOrderCreationEdit',
  components: {
    dialogHeader: () => import('@/components/dialogHeader') // 弹窗标题
  },
  // 组件混入对象
  mixins: [formMixins],
  data() {
    return {
      // h3标题行内样式
      styleObj: { borderLeft: null },
      //
      Filed: array => attr =>
        array.reduce((p, c) => {
          p[c[attr]] = ''
          return p
        }, {}),
      // 保存API配置对象
      apiConfig: this.dynamicApiConfig,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          clickEvent: () => this.save(),
          text: this.$t('审核')
        }, // '添加'
        {
          compKey: 'btnKey2',
          size: 'small',
          clickEvent: () => this.reset(),
          text: this.$t('驳回')
        } // 驳回
      ],
      // 动态组件-查询条件
      tableComponents:
          [
            {
              compKey: 'compKey1',
              labelName: '退货类型：',
              codeField: 'returnType',
              component: () => import('@/components/org/commonInput'),
              type: 'dropdownList',
              isMust: true,
              isRequire: true,
              span: 8
            },
            {
              compKey: 'compKey2',
              labelName: '订单号：',
              codeField: '',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true,
              span: 8
            },
            {
              compKey: 'compKey3',
              labelName: '销退申请单号：',
              codeField: 'salesReturnApplicationNumber',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true,
              span: 8
            },
            {
              compKey: 'compKey4',
              labelName: '申请人：',
              codeField: 'applicant',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isRequire: true,
              isMust: true
            },
            {
              compKey: 'compKey5',
              labelName: '申请日期：',
              codeField: 'applicationDate',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compKey6',
              labelName: '退货申请原因：',
              codeField: 'returnRequestReason',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compKey7',
              labelName: '门店编码：',
              codeField: 'storeCode',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compKey8',
              labelName: '门店名称：',
              codeField: 'storeName',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compKey9',
              labelName: '退货金额：',
              codeField: 'totalReturnAmount',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true,
              isRequire: true
            }
          ],
      // 表单数据（无需赋值，由混入对象赋值）
      formField: {},
      initFormField: null,

      textMap: {
        edit: '销退申请单审核'
      }
    }
  },

  methods: {
    closePopups() {
      this.$emit('update:popupsVisible', false)
    },

    save() {
    }
  }
}
</script>
<style scoped>
</style>
